package binaryTree;

import sun.reflect.generics.tree.Tree;

public class pruneTree {
    public TreeNode pruneTreeTest(TreeNode root){
        return deal(root);
    }
    public static TreeNode deal(TreeNode root){
        if(root==null){
            return null;
        }
        root.left=deal(root.left);
        root.right=deal(root.right);
        if (root.right==null&&root.right==null&&root.val==0){
            return null;
        }
        return root;
    }
}
